Skip to main content

Save API Tool

Used to create or update an API tool that can be used by AI agents. API tools allow agents to interact with external services and APIs to extend their capabilities.

API Endpoint

PropertyValue
Request MethodPOST
Request URLhttps://api.seliseblocks.com/tools/api

Request

Request Example

curl -X POST 'https://api.seliseblocks.com/tools/api' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"id": "tool_weather_api",
"name": "Weather API",
"description": "Retrieves current weather information for a given location",
"base_url": "https://api.weather.com/v1",
"project_key": "YOUR_PROJECT_KEY"
}'

Request Headers

FieldTypeRequiredDescription
acceptstringYesAccepted response format. Use application/json
Content-Typeapplication/jsonYesData type, must be application/json.

Request Body

Request Body Schema

{
"id": "string",
"name": "string",
"description": "string",
"base_url": "string",
"project_key": "string"
}

Request Body Parameters

FieldTypeRequiredDescription
idstringNoUnique identifier for the tool. If provided, updates existing tool; otherwise creates new tool.
namestringYesDisplay name of the API tool.
descriptionstringYesDescription of what the API tool does and how it should be used.
base_urlstringYesBase URL of the API endpoint.
project_keystringYesThe project key for your project.
tip

Creating vs Updating Tools

  • Create: Omit the id field or provide a new unique ID to create a new tool
  • Update: Provide an existing id to update the tool's configuration

Best Practices

  • Use descriptive names that clearly indicate the tool's purpose
  • Write detailed descriptions to help the AI understand when and how to use the tool
  • Ensure the base URL is accessible and properly formatted
  • Include API version in the base URL if applicable
note

Tool Description Guidelines The description field is crucial for helping the AI agent understand:

  • What functionality the tool provides
  • When it should be used
  • What parameters it expects
  • What kind of data it returns

Write descriptions that are clear, concise, and include relevant examples or use cases.

Response

Success Response (201 Created)

Returns an object containing the creation/update status and tool details.

{
"is_success": true,
"item_id": "tool_weather_api",
"detail": "API tool created successfully",
"error": {}
}

Response Fields

FieldTypeDescription
is_successbooleanIndicates whether the operation was successful.
item_idstringUnique identifier of the created or updated tool.
detailstringSuccess or failure message with additional context.
errorobjectError details if the operation failed (empty if successful).

Example Use Cases

// Weather API Tool
{
"name": "Weather API",
"description": "Fetches current weather data including temperature, humidity, and conditions for any city worldwide. Use when users ask about weather conditions.",
"base_url": "https://api.openweathermap.org/data/2.5",
"project_key": "YOUR_PROJECT_KEY"
}

// CRM Integration Tool
{
"name": "CRM Customer Lookup",
"description": "Searches customer records in the CRM system. Returns customer details, order history, and support tickets. Use when users need customer information.",
"base_url": "https://api.yourcrm.com/v2",
"project_key": "YOUR_PROJECT_KEY"
}

// Payment Processing Tool
{
"name": "Payment Gateway",
"description": "Processes payment transactions and retrieves payment status. Use for payment-related queries and transaction processing.",
"base_url": "https://api.stripe.com/v1",
"project_key": "YOUR_PROJECT_KEY"
}

Error Response (422 Unprocessable Entity)

Returns validation error details when the request body is invalid.

{
"detail": [
{
"loc": [
"body",
"base_url"
],
"msg": "invalid or missing URL scheme",
"type": "value_error.url.scheme"
}
]
}

Error Response Fields

FieldTypeDescription
detailarrayArray of validation error objects.
locarrayLocation of the error in the request (e.g., body field).
msgstringHuman-readable error message.
typestringError type identifier.

Error Codes

Status CodeDescriptionResponse Type
201Created - Tool created/updated successfullySuccess
400Bad Request - Invalid tool configurationBad Request
422Validation Error - Invalid request parametersUnprocessable Entity
500Internal Server Error - Operation failedServer Error
warning

Security Considerations

  • Ensure API endpoints are secure and use HTTPS
  • Implement proper authentication mechanisms for sensitive APIs
  • Validate and sanitize all API responses before using them
  • Consider rate limiting to prevent abuse
  • Store API keys and credentials securely (not in the tool configuration)
  • Monitor tool usage for unusual patterns or potential security issues